<h2 class="popover-title">Chi tiết mail #<?= $sent_mail['sent_mail_id'] ?></h2>
<?php $receivers = $sent_mail['receiver']; ?>
<div id="action" style="margin-top: 10px;">
  <a class="btn btn-mini btn-danger btn_delete" href="<?= URL ?>?page=mail_da_gui&act=delete&sent_mails[]=<?= $sent_mail['sent_mail_id'] ?>"><i class="icon-trash icon-white"></i> Xóa</a>
</div>
<table class="table table-striped table-bordered table-condensed" style="margin-top: 10px">
<tbody>
<tr>
  <th width="115">
    To
  </th>
  <td>
    <?php foreach ($receivers['to'] as $to): ?>
      <?php if ($to['friend_group_id']): ?>
      <a href="#" class="label label-info"><?= $to['name'] ?></a>
      <?php elseif ($to['friend_id']): ?>
      <a href="#" class="label"><?= $to['fullname'] ?></a>
      <?php else: ?>
      <span class="label label-success"><?= $to['mail'] ?></span>
      <?php endif; ?>
    <?php endforeach; ?>
  </td>
</tr>
<tr>
  <th>
    Cc
  </th>
  <td>
    <?php foreach ($receivers['cc'] as $cc): ?>
      <?php if ($cc['friend_group_id']): ?>
      <a href="#" class="label label-info"><?= $cc['name'] ?></a>
      <?php elseif ($cc['friend_id']): ?>
      <a href="#" class="label"><?= $cc['fullname'] ?></a>
      <?php else: ?>
      <span class="label label-success"><?= $cc['mail'] ?></span>
      <?php endif; ?>
    <?php endforeach; ?>
  </td>
</tr>
<tr>
  <th>
    Bcc
  </th>
  <td>
    <?php foreach ($receivers['bcc'] as $bcc): ?>
      <?php if ($bcc['friend_group_id']): ?>
      <a href="#" class="label label-info"><?= $bcc['name'] ?></a>
      <?php elseif ($bcc['friend_id']): ?>
      <a href="#" class="label"><?= $bcc['fullname'] ?></a>
      <?php else: ?>
      <span class="label label-success"><?= $bcc['mail'] ?></span>
      <?php endif; ?>
    <?php endforeach; ?>
  </td>
</tr>
<tr>
  <th>Ngày gửi</th>
  <td><?= $sent_mail['sent_date'] ?></td>
</tr>
<tr>
  <th>Tiêu đề</th>
  <td><?= $sent_mail['subject'] ?></td>
</tr>
<tr>
  <th>Nội dung</th>
  <td style="background: white"><?= $sent_mail['message'] ?></td>
</tr>
<tr>
<th>Tệp đính kèm</th>
  <td>
    <?php $afiles = $sent_mail['attached_files']; ?>
    <?php foreach ($afiles as $afile): ?>    
      <a href="<?= URL . 'upload/attached_file/' . $sent_mail['attached_dir'] . '/' . $afile ?>" target="_blank"><?= $afile ?></a> <br />
    <?php endforeach; ?>
  </td>
</tr>
</tbody>
</table>